package bsr.basara.autodata.dao;

import bsr.basara.autodata.entity.ColumnInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Component;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author basara
 */
@Component
public interface ColumnInfoRepository extends JpaRepository<ColumnInfo, Long> {

    @Modifying
    @Transactional
    void deleteByTableIdIn(List<Long> tableIds);

    List<ColumnInfo> findByTableId(Long tableId);

    List<ColumnInfo> findByTypeAndTableId(Integer type, Long tableId);

}
